﻿<!DOCTYPE>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <title>热表整改措施管理</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
    <link rel="stylesheet" href="/InSiteWebApplication/Content/webuploader/webuploader.css" />
</head>
<body style="width:99.9%">
    <div class="panelSection">
        <div class="easyui-panel " title="查询区域" style="padding: 3px; width: 100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false">
            <form id="queryForm" action="">
            <div style="margin: 3px 0px 3px 3px">
                <div style="float: left;">
                    <div class="divLabel" style="margin-bottom: 5px">
                        订单号：</div>
                    <input id="txtMfgOrderName_qf" name="mfgOrderName" class="easyui-textbox" style="width: 120px;
                        height: 20px" />
                </div>
                <div style="float: left; margin-left: 10px;">
                    <div class="divLabel" style="margin-bottom: 5px">
                        零件号：</div>
                    <input id="txtProductName_qf" name="productName" class="easyui-textbox" style="width: 120px;
                        height: 20px" />
                </div>
                <div style="float: left; margin-left: 10px;">
                    <div class="divLabel" style="margin-bottom: 5px">
                        批次号：</div>
                    <input id="txtContainerName_qf" name="containerName" class="easyui-textbox" style="width: 120px;
                        height: 20px" />
                </div>
                <!-- <div style="float: left; margin-left: 10px;">
                        <div class="divLabel" style="margin-bottom: 5px">
                            状态：</div>
                        <select style='width: 100px; height: 20px' id='selStatus' name="status" data-options="editable:false,panelHeight:'auto'"
                            class='easyui-combobox'>
                            <option value="">请选择</option>
                            <option value="1">启用</option>
                            <option value="0">停用</option>
                        </select>
                    </div>-->
                <div style="float: left; margin-left: 20px">
                    <a id="btnSearch" href='#' class="easyui-linkbutton" style="margin-top: 16px; width: 120px">
                        查询</a> <a id="btnReset" href='#' class="easyui-linkbutton" style="margin-top: 16px;
                            margin-left: 5px;">重置</a>
                </div>
                <div style="clear: both">
                </div>
            </div>
            </form>
        </div>
    </div>
    <div class="panelSection">
        <div class="easyui-panel " title="结果区域" style="padding: 3px; width: 100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false">
            <div style="margin: 3px 0px 3px 3px; height: 70%">
                <table id="gdContainerInfo" class="easyui-datagrid" style="width: 100%; height: 100%"
                    data-options="fitColumns:true,rownumbers:true">
                </table>
                <div id="pp" style="float: right" class="easyui-pagination" data-options="   
                 layout:['list','first','prev','next','last','manual','info'],              
                    total: 0,
                    showPageList: true,
                    showPageInfo: false,
                    showRefresh: false,
                    afterPageText:'共&nbsp{pages}&nbsp页',
                    buttons:[{
                            iconCls:'',
                            text:'Go',
                            id:'pageGo'
                    }]  
                ">
                </div>
            </div>
        </div>
    </div>
    <div class="panelSection">
        <div class="easyui-panel " title="维护区域" style="padding: 3px; width: 100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false">
            <div style="float: left;">
                整改百分比：</div>
            <div style="float: left; margin-left: 10px;">
                <select style='width: 100px; height: 20px' id='selMeasures' name="measures" data-options="editable:false,panelHeight:'auto'"
                    class='easyui-combobox'>
                    <option value="">请选择</option>
                    <option value="25%">25%</option>
                    <option value="50%">50%</option>
                    <option value="75%">75%</option>
                    <option value="100%">100%</option>
                </select>
            </div>
            <div style="float: left; margin-left: 10px;">
                <a id="btnSave" href='#' class="easyui-linkbutton" style="width: 150px">保存</a>
            </div>
        </div>
    </div>
</body>
</html>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/ReferenceJsLib.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script type="text/javascript" src="/InSiteWebApplication/Content/webuploader/webuploader.js"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script type="text/javascript">
    /*
    创建人：zhangrj
    日期：2025-04-08
    描述：热表整改措施管理js
    */
    var page = {
        pageTotal: 0,
        pageSize: 20,
        pageNumber: 1,
        rootPath: getRootPath(), //网站根路径
        url: getRootPath() + "/Ashx/ReBiaoConainer/RbRectifyMeasuresManageHandler.ashx",
        //初始化页面
        init: function () {
            page.bind();
            customizedEasyuiPagination('pp'); //定制化分页
        },
        //页面事件绑定
        bind: function () {
            //列表加载
            $("#gdContainerInfo").datagrid({
                onLoadSuccess: function (data) {
                    $('#pp').pagination('refresh', {	// 改变选项，并刷新分页栏信息
                        total: page.pageTotal,
                        pageSize: page.pageSize,
                        pageNumber: page.pageNumber
                    });
                    customizedEasyuiPagination('pp'); //定制化分页
                },
                columns: [[
          { field: 'ck', title: '选择', checkbox: true },
          { field: 'MFGORDERNAME', title: '订单号', width: 120 },
          { field: 'PRODUCTNAME', title: '零件号', width: 120 },
          { field: 'CONTAINERNAME', title: '批次号', width: 250 },
          { field: 'WORKFLOWSTEPNAME', title: '工序', width: 120 },
          { field: 'STEPNO', title: '工步号', width: 120 },
          { field: 'STEPNAME', title: '工步名', width: 100 },
          { field: 'REWORKQTY', title: '返修数', width: 100 },
          { field: 'LOSSQTY', title: '报废数', width: 100 },
          { field: 'RECTIFYMEASURES', title: '整改措施', width: 100 }
        ]]
            });

            //查询按钮
            $('#btnSearch').on("click", function () {
                page.clearPage(false, true);
                page.pageNumber = 1;
                page.searchData();
            });
            //保存按钮
            $('#btnSave').on("click", function () {
                page.saveData();
            });
            //分页事件
            $('#pp').pagination({
                onSelectPage: function (pageNumber, pageSize) {
                    page.pageSize = pageSize; page.pageNumber = pageNumber === 0 ? 1 : pageNumber;
                    page.searchData();
                }
            });
            //绑定分页go按钮
            $('#pageGo').on("click", function () {
                var pageNumber = Number($(this).parents('tr').find('.pagination-num').val());
                page.pageSize = $(".pagination-page-list").val();
                page.pageNumber = pageNumber;
                page.searchData();
            });
            //清除按钮
            $('#btnReset').on("click", function () {
                page.clearPage(true, true);
                page.pageNumber = 1; page.pageTotal = 0
                $('#pp').pagination('refresh', {
                    total: page.pageTotal,
                    pageSize: page.pageSize,
                    pageNumber: page.pageNumber
                });
            });
        },
        //查询
        searchData: function () {
            var params = {
                pageSize: page.pageSize,
                pageIndex: page.pageNumber
            };
            var queryFormData = $("#queryForm").serializeArray();
            $.each(queryFormData, function () {
                params[this.name] = this.value;
            });
            page.post(page.url, { action: "GetRectifyMeasuresList", paramData: JSON.stringify(params) }, true, function (res) {
                if (!res.Result) {
                    displayMessage(res.Message, res.Result);
                    return;
                }
                page.pageTotal = res.RowCount;
                $("#gdContainerInfo").datagrid('loadData', { total: res.RowCount, rows: res.DBTable });
            });
        },
        //保存
        saveData: function () {
            var selectRow = $("#gdContainerInfo").datagrid("getChecked");
            if (selectRow.length === 0) {
                displayMessage("请选择数据", false);
                return false;
            }
            var measures = $("#selMeasures").combobox("getValue");
            if (measures === null || measures === "") {
                displayMessage("请选择整改百分比", false);
                return false;
            }
            var datas = selectRow.map(function (item) {
                return {
                    containerCheckInfoID: item.CONTAINERCHECKINFOID
                }
            });
            var params = {
                action: "SaveContainerCheckRectifyMeasures",
                datas: JSON.stringify(datas),
                measures: measures
            };
            page.post(page.url, params, true, function (res) {
                if (res.Result) {
                    page.searchData();
                }
                displayMessage(res.Message, res.Result);
            });
        },
        //禁用页面按钮
        disableBtn: function () {
            $("body").find(".easyui-linkbutton").each(function () {
                $(this).linkbutton('disable');
            });
        },
        //启用页面按钮
        enableBtn: function () {
            $("#body").find(".easyui-linkbutton").each(function () {
                $(this).linkbutton('enable');
            });
        },
        //清除页面（查询区域，列表区域）
        clearPage: function (query, list) {
            if (query) {
                $("#txtProductName_qf").textbox("clear");
                $("#txtMfgOrderName_qf").textbox("clear");
                $("#txtContainerName_qf").textbox("clear");
            }
            if (list) {
                clearEasyuiDataGrid("gdContainerInfo"); //清空列表
            }
        },
        //post数据（路径，参数，是否异步，成功返回方法）
        post: function (url, param, async, callback) {
            $.ajax({
                type: "Post",
                url: url,
                data: param,
                cashe: false,
                async: async,
                dataType: "json",
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    callback(data);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    displayMessage(XMLHttpRequest.responseText, false);
                    $("body").find(".easyui-linkbutton").each(function () {
                        $(this).linkbutton('enable');
                    });
                }
            });
        }
    };
    $(function () {
        page.init();
    });
</script>
